package edu.xidian.bdilab.jrbigdata.controller.enterprise;

import edu.xidian.bdilab.jrbigdata.controller.response.ResponseResult;
import edu.xidian.bdilab.jrbigdata.domain.EnterpriseInfo;
import edu.xidian.bdilab.jrbigdata.service.enterprise.infoModification.InfoModService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName InfoModificationController
 * @Description TODO
 * @Author tuantuan
 * @Date 2019/4/4 上午10:07
 * @Version 1.0
 * @Attention Copyright (C), 2004-2019, BDILab, XiDian University
 **/
@RestController
@Api(tags = {"InfoModification-企业信息修改"})
public class InfoModificationController {
    @Autowired
    InfoModService infoModService;

    @PostMapping(value = "enterprise/InformationModification")
    public ResponseResult infoFeedback(@RequestParam String socialCode){
        ResponseResult responseResult = new ResponseResult();
        responseResult.setData(infoModService.checkInfoById(socialCode));
        responseResult.setSuccess(true);
        responseResult.setCode(EnterpriseCode.INFO_CHECK_SUCCESS.getCode());
        responseResult.setMessage(EnterpriseCode.INFO_CHECK_SUCCESS.getMessage());
        return responseResult;
    }

    @PostMapping(value = "enterprise/InformationModification/post")
    public ResponseResult InfoModification(@RequestBody EnterpriseInfo enterpriseInfo){
        infoModService.modifyInfo(enterpriseInfo);
        ResponseResult responseResult = new ResponseResult(true,EnterpriseCode.INfO_MODIFY_SUCCESS.getCode(),EnterpriseCode.INfO_MODIFY_SUCCESS.getMessage());
        return responseResult;
    }

}
